package com.gx.smart.building.ui.swap.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.gx.smart.base.BaseAdapter;
import com.gx.smart.building.R;
import com.gx.smart.building.databinding.ItemSwapDeviceStatusResultLayoutBinding;
import com.huishi.gx.ib.grpc.lib.ib.admin.schedule.v1.RecordContent;

/**
 * @author: xiaosy
 * 时间: 2022/9/6
 * @Description: 读数记录
 * @Version: 1.0
 **/
public class SwapDeviceStatusResultAdapter extends BaseAdapter<RecordContent, SwapDeviceStatusResultAdapter.ViewHolder> {

    public SwapDeviceStatusResultAdapter(Context context) {
        super(context);
    }

    @Override
    protected int onBindLayout() {
        return R.layout.item_swap_device_status_result_layout;
    }

    @Override
    protected ViewHolder onCreateHolder(View view) {
        ItemSwapDeviceStatusResultLayoutBinding binding = ItemSwapDeviceStatusResultLayoutBinding
                .inflate(LayoutInflater.from(mContext), (ViewGroup) view, false);
        return new ViewHolder(binding);
    }

    @Override
    protected void onBindData(ViewHolder holder, RecordContent item, int position) {
        holder.binding.title.setText(item.getContentName());
        holder.binding.value.setText(item.getContentValue());
    }

    public static class ViewHolder extends RecyclerView.ViewHolder {
        private ItemSwapDeviceStatusResultLayoutBinding binding;

        public ViewHolder(@NonNull ItemSwapDeviceStatusResultLayoutBinding binding) {
            super(binding.getRoot());
            this.binding = binding;
        }
    }
}
